package com.briup.day03;

public class Test_Math {
    public static void main01(String[] args) {
        int a = 6;
        int b = 4;
        double d = a + b;
        System.out.println(a + b);
        System.out.println(a * b);
        System.out.println(a / b);
        System.out.println(a % b);
        System.out.println(a - b);
        System.out.println(d / b);
    }

    //从座到右依次计算，字符串＋其他数是字符串
    public static void main(String[] args) {
        System.out.println("hello" + 'a' + 1);
        System.out.println('a' + 1 + "hello");
        System.out.println("5+5=" + 5 + 5);
        System.out.println(5 + 5 + "=5+5");
    }

    public static void main03(String[] args) {
        //自增或自减，单独使用没有区别
        int a = 10;
        a++;
        System.out.println(a);
        a = 10;
        ++a;
        System.out.println(a);
    }

    public static void main02(String[] args) {
        //作为表达式使用 后++ 先赋值再自增 前++先自增再赋值
        int a = 10;
        int b = a++;
        System.out.println("后++: " + "a:" + a + "b:" + b);

        a=10;
        b=++a;
        System.out.println("前++: " + "a:" + a + "b:" + b);

        int x = 4;
        int y = (x--) + (--x) + (x * 10);
        System.out.println("x: " + x); // x: ?
        System.out.println("y: " + y); // y: ?
    }
}
